#ifdef GL_ES precision mediump float; #endif #extension GL_OES_standard_derivatives : enable uniform float u_time; uniform vec2 u_mouse; uniform vec2 u_resolution; vec2 brickTile(vec2 uv, float zoom) { uv *= zoom; uv.x += step(1., mod(uv.y,2.0)) * -u_time; return fract(uv); } vec2 brickTile2(vec2 uv, float zoom) { uv *= zoom; float t = mod(uv.y,2.0) < 1. ? -u_time : u_time; uv.x += step(0., mod(uv.y,2.0)) * t; return fract(uv); } vec2 brickTile3(vec2 uv, float zoom) { uv *= zoom; float tx = mod(uv.y,2.0) < 1. ? -u_time : u_time; float ty = mod(uv.x,2.0) < 1. ? -u_time : u_time; float b = step(1.,mod(u_time,2.)); if(b < 1.) { uv.x += step(0., mod(uv.y,2.0)) * tx; } else { uv.y += step(0., mod(uv.x,2.0)) * ty; } return fract(uv); } void main( void ) { vec2 position = ( gl_FragCoord.xy / u_resolution.xy ); position.x *= u_resolution.x / u_resolution.y; //position = brickTile(position,5.); //position = brickTile2(position,10.); position = brickTile3(position,10.); float d = distance(position,vec2(.5)); float radius = 0.2; float s = smoothstep(radius,d + radius, d); vec3 color = vec3(s * 5.); color = mix(color,1.- color,sin(u_time) + 1.); gl_FragColor = vec4( color , 1.0 ); }